<!DOCTYPE HTML>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <link rel="stylesheet" type="text/css" href="../css/stylesheet.css">
    <title>华工权小益提案收集平台</title>
    <script type="text/javascript">
        function checkSubmit(form) {
            if ($id('name').value == '') {
                alert('提案人姓名不能为空');
                form.name.focus();
                return false;
            }
            if ($id('phone').value == '') {
                alert('电话不能为空');
                form.phone.focus();
                return false;
            }
            if ($id('qq').value == '') {
                alert('QQ不能为空');
                form.qq.focus();
                return false;
            }
            if ($id('title').value == '') {
                alert('标题不能为空');
                form.title.focus();
                return false;
            }
            if ($id('content').value == '') {
                alert('提案内容不能为空');
                form.content.focus();
                return false;
            }
            document.form.submit();
        }

        function $id(d) {
            return document.getElementById(d);
        }
        //上传图片
        //author:zmf
        //2017.11.04
        oFReader = new FileReader(), rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;

        oFReader.onload = function(oFREvent) {
            document.getElementById("uploadPreview").src = oFREvent.target.result;
            document.getElementById("uploadPreview").style.opacity = 1;
            document.getElementById("down").style.marginTop = "155px";
        };

        function loadImageFile() {
            if (document.getElementById("uploadImage").files.length === 0) {
                return;
            }
            var oFile = document.getElementById("uploadImage").files[0];
            if (!rFilter.test(oFile.type)) {
                alert("请选择一张图片文件");
                return;
            }
            oFReader.readAsDataURL(oFile);
        }
    </script>
</head>

<body>
    <div class="header">
        <a href="../index.html"><img src="../img/newhead.jpg"></a>
    </div>
    <div class="clear"></div>
    <form action='raise.php' method='post' name="form">
        <div class="raise">
            <div style="text-align: left;margin-top:5px;cmargin-bottom:5px;color:#FFFFFF;font-size:11px;"><span>*首次报修请点击平台下方标签“提案平台”→“报修平台”进行报修。</br>*报修长久未果的同学提出提案时请留下您的宿舍号~</span></div>
            <input type="text" name='name' id='name' class="raiseinfo" placeholder="提案人姓名">
            <input type="text" name='phone' id='phone' class="raiseinfo" placeholder="电话" onkeyup="value=value.replace(/[^\d]/g,'') ">
            <input type="text" name='qq' id='qq' class="raiseinfo" placeholder="QQ(用于后期联系)" maxlength="15" onkeyup="value=value.replace(/[^\d]/g,'') ">
            <select name='campus' class="raiseoption">
                    <option>五山校区</option>
                    <option>大学城校区</option>
                </select>
            <select name='type' class="raiseoption">
                    <option>校园环境</option>
                    <option>学生生活</option>
                    <option>后勤服务</option>
                    <option>饭堂意见</option>
                </select>
            <input type="text" name='title' id='title' class="raiseinfo" placeholder="标题(15字以内)" maxlength="15">
            <textarea name='content' id='content' class="raisedata raisepicrem" placeholder="提案内容（200字以内）" maxlength="200"></textarea>
            <!--<div style="text-align: left;margin-bottom:5px;color:#FFFFFF;font-size:11px;"><span>*若有照片请通过微信平台聊天窗口发给我们，并注明提案标题，谢谢!</br>*想知道提案解决进度，请点击平台下方菜单“提案平台”→“提案汇总”查询。</span></div>-->
            <div class="addImg">
                <input id="uploadImage" type="file" name="myPhoto" onchange="loadImageFile();" />上传图片
            </div>
            <div class="preview">
                <img id="uploadPreview">
                <!-- <div id="scan" style="width: 200px; height: 200px; border: 1px solid rgb(255, 255, 255);margin-top:10px;margin-left:500px;"></div>-->
            </div>
            <!-- 需要提交后把上述四项数据写进数据库 -->
            <input type='button' class="csubmit" id="down" value='提交' onclick="checkSubmit(this.form);" style="color:#FFFFFF;">
        </div>
    </form>
    <div class="clear"></div>
    <div class="wholecori-raise">
        <div class="copyright">
            <span>Copyright © 2017 华南理工大学学生会权益部</span>
        </div>
        <div class="copyright">
            <span>Power by 无线电爱好者协会信息部</span>
        </div>
    </div>
    <div class="clear"></div>
</body>

</html>